using System.Web.UI;
using System.Web.UI.WebControls;

namespace SouthernLand.Common.Untilities
{
    [ParseChildren(true)]
    public class ImageObject : Image
    {
        public int DefaultWidth { get; set; }

        public int DefaultHeight { get; set; }

        public string ImageName { get; set; }

        public string ImagePath { get; set; }

        public int ImageWidth { get; set; }

        public int ImageHeight { get; set; }


        public string ImageFilter { get; set; }

        protected override void CreateChildControls()
        {
            EnableViewState = false;

            if (ImageFilter == "" || ImageFilter == null)
            {
                Attributes.Add("onload", "this.style.filter='alpha(opacity=100,finishopacity=100,style=1)';");
                Attributes.Add("onmouseover", "this.style.filter='alpha(opacity=60,finishopacity=50,style=1)';");
                Attributes.Add("onmouseout", "this.style.filter='alpha(opacity=100,finishopacity=100,style=1)';");
            }

            if (ImageName != "")
            {
                ImageUrl = ImagePath + ImageName;
                // this.ToolTip = ImageName;
            }
            else
            {
                Visible = false;
            }
        }
    }
}